// 从用户输入中读取一个目标值和一组整数，然后在这组整数中找出两个数，
// 使它们的和等于目标值，并输出这两个数的下标。如果没有找到这样的两个数，则输出 -1。
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void async function () {
    const input = await readline();
    const parts = input.split(' ');
    const target = parseInt(parts[0]);
    const nums = parts.slice(1).map(num => parseInt(num));
    let found = false;
    for (let i = 0; i < nums.length; i++) {
        for (let j = i + 1; j < nums.length; j++) {
            if (nums[i] + nums[j] === target) {
                console.log(i + " " + j);
                found = true;
                break;
            }
        }
        if (found) {
            break;
        }
    }
    if (!found) {
        console.log(-1);
    }
}()